﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace weighing
{
    class BillStatusVisiblityConverter : System.Windows.Data.IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var vo = (WeighingBillVo) value;
            if(vo.Status == (int)BillStatus.NoOut)
            {
                if(vo.Type == (int)WeightingBillType.Buy && App.Config.BillPrintConfig.EnableUnloadBill)
                {
                    return System.Windows.Visibility.Visible;
                }
                else if (vo.Type == (int)WeightingBillType.Sale && App.Config.BillPrintConfig.EnableLoadBill)
                {
                    return System.Windows.Visibility.Visible;
                }
            }
            else
            {
                return System.Windows.Visibility.Visible;
            }
            return System.Windows.Visibility.Collapsed;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
